package com.qianbei.common.view;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.MotionEvent;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.qianbei.R;
import com.qianbei.common.base.BaseActivity;

/**
 * Created by user on 16/8/17.
 */
public class AvatarPreview extends BaseActivity {

    private ImageView mImageView;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_avatar_preview);

        mImageView = (ImageView) findViewById(R.id.iv_image);

        String url = getIntent().getStringExtra("url");

        Glide.with(this)
                .load(url)
                .crossFade()
                .into(mImageView);
    }


    @Override
    public boolean onTouchEvent(MotionEvent event) {
        finish();
        overridePendingTransition(-1, R.anim.head_out);
        return true;
    }

    @Override
    protected void onStop() {
        super.onStop();
        Glide.with(this).pauseRequests();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
    }

    @Override
    public void onBackPressed() {
        super.onBackPressed();
        finish();
        overridePendingTransition(-1, R.anim.head_out);
    }
}
